package com.luxsoft.siipap.cxp.ui.selectores;

import java.util.List;

import ca.odell.glazedlists.GlazedLists;
import ca.odell.glazedlists.gui.TableFormat;

import com.luxsoft.siipap.compras.model.Embarcacion;
import com.luxsoft.siipap.service.ServiceLocator2;
import com.luxsoft.siipap.swing.dialog.AbstractSelector;


public class SelectorDeEmbarques extends AbstractSelector<Embarcacion>{

	public SelectorDeEmbarques() {
		super(Embarcacion.class, "Embarques disponibles");
	}

	@Override
	protected TableFormat<Embarcacion> getTableFormat() {
		String[] props={
				"id"
	        	,"nombre"
	        	,"fecha"
	        	,"embarqueBL"
	        	,"contenedores"
	        	,"proveedor.nombre"        	
	            ,"aduana"
	            ,"ingresoAduana"
	            ,"autorizacionAduana"
	            ,"referenciaAduanal"
	            ,"pedimento"
	            ,"facturada"
	            ,"agenteAduanal.nombre"	
		};
		String[] names={
				"id"
            	,"Nombre"
            	,"Fecha"
            	,"BL"
            	,"Contenedores"
            	,"Proveedor"        	
                ,"Aduana"
                ,"Ingreso (Aduana)"
                ,"Aut(Aduana)"
                ,"Ref Aduanal"
                ,"Pedimento"
                ,"Facturada"
                ,"Agente"
		};
		return GlazedLists.tableFormat(Embarcacion.class,props, names);
	}

	@Override
	protected List<Embarcacion> getData() {
		String hql="from Embarcacion e where e.autorizacionAduana is null";
		return ServiceLocator2.getHibernateTemplate().find(hql);
	}

}
